// 先引入经过自定义全局封装的 axios
import request from '/@/utils/request';

// 代理级别列表
export function agentList() {
	return request({
		url: '/applet/agent/level',
		method: 'GET',
	});
}


// 代理级别新增
export function agentAdd(params: any) {
	return request({
		url: '/applet/agent/level',
		method: 'POST',
		data: params,
	});
}

// 代理级别详情
export function agentInfo(id: any) {
	return request({
		url: `/applet/agent/level/${id}`,
		method: 'GET',
	});
}


// 代理级别删除
export function agentDelete(id: number) {
	return request({
		url: `/applet/agent/level/${id}`,
		method: 'DELETE',
	});
}

// 获取代理升级设置
export function getUpgrade(params: any) {
	return request({
		url: '/applet/agent/upgrade/condition',
		method: 'GET',
		data: params,
	});
}

// 修改代理升级设置
export function postUpgrade(params: any) {
	return request({
		url: '/applet/agent/upgrade/condition',
		method: 'POST',
		data: params,
	});
}


// 代理进货设置详情
export function agentStockInfo() {
	return request({
		url: '/applet/agent/config/stock/info',
		method: 'GET',
	});
}

// 代理进货设置保存
export function agentStockSave(params: any) {
	return request({
		url: '/applet/agent/config/stock/save',
		method: 'POST',
		data: params,
	});
}




// 代理商品列表

export function goodsList(params: any) {
	let paramsQuery: any = JSON.parse(JSON.stringify(params))
	paramsQuery.current = params.pageNum;
	paramsQuery.size = params.pageSize;
	return request({
		url: '/applet/agent/price/list',
		method: "GET",
		data: paramsQuery,
	});
}

// 自定义商品价格保存
export function goodsPriceSave(params: any) {
	return request({
		url: '/applet/agent/price/save',
		method: "POST",
		data: params,
	});
}

// 自定义商品删除spu

export function spuPriceDelete(params: any) {
	return request({
		url: '/applet/agent/price/delete',
		method: "DELETE",
		data: params,
	});
}


// 自定义商品删除sku
export function skuPriceDelete(params: any) {
	return request({
		url: '/applet/agent/price/sku/delete',
		method: "DELETE",
		data: params,
	});
}



// 代理升级记录
export function getUpgradeRecord(params: any) {
	let paramsQuery: any = JSON.parse(JSON.stringify(params))
	paramsQuery.current = params.pageNum;
	paramsQuery.size = params.pageSize;
	return request({
		url: '/applet/agent/upgrade',
		method: "GET",
		data: paramsQuery,
	});
}


// 代理加入审核查询
export function getAgentAuditJoinList(params: any) {

	return request({
		url: '/applet/agent/audit/join/list',
		method: "GET",
		params: params,
	});
}
// 代理升级审核查询
export function getAgentAuditUpgradeList(params: any) {

	return request({
		url: '/applet/agent/audit/upgrade/list',
		method: "GET",
		params: params,
	});
}
export function agentAuditUpgradeAudit(data: any) {

	return request({
		url: '/applet/agent/audit/upgrade/audit',
		method: "POST",
		data

	});
} //代理升级审核通过/拒绝
export function agentAuditJoinAudit(data: any) {

	return request({
		url: '/applet/agent/audit/join/audit',
		method: "POST",
		data

	});
} //代理加入审核通过/拒绝
// 代理业绩分页列表
export function getAgentPerformanceList(params: any) {
	// let paramsQuery : any = JSON.parse(JSON.stringify(params))
	return request({
		url: '/applet/agent/performance/list',
		method: "GET",
		params: params,
	});
}
// 代理变更记录分页列表
export function getAgentDataChangeList(params: any) {
	// let paramsQuery : any = JSON.parse(JSON.stringify(params))
	return request({
		url: '/applet/agent/data/change/list',
		method: "GET",
		params: params,
	});
}

// 代理手动回归列表查询
export function getAgentReturnList(params: any) {
	// let paramsQuery : any = JSON.parse(JSON.stringify(params))
	return request({
		url: '/applet/agent/return/list',
		method: "GET",
		params: params,
	});
}
//代理回归 手动回归
export function agentReturnManually(params: any) {
	// let paramsQuery : any = JSON.parse(JSON.stringify(params))
	return request({
		url: '/applet/agent/return/manually',
		method: "GET",
		params: params,
	});
}
//代理回归 回归记录
export function getAgentReturnRecord(params: any) {
	// let paramsQuery : any = JSON.parse(JSON.stringify(params))
	return request({
		url: '/applet/agent/return/record/list',
		method: "GET",
		params: params,
	});
}
//代理邀请配置信息查询


export function getAgentConfigInviteInfo() {
	// let paramsQuery : any = JSON.parse(JSON.stringify(params))
	return request({
		url: '/applet/agent/config/invite/info',
		method: "GET",
	});
}
//代理邀请配置信息修改

export function agentConfigInviteSave(data: any) {
	return request({
		url: '/applet/agent/config/invite/save',
		method: "POST",
		data
	});
}
//代理变更类型列表

export function getAgentDataChangeType() {
	return request({
		url: '/applet/agent/data/change/type',
		method: "GET"
	});
}

// 业绩调整
export function performanceChange(params: any) {
	return request({
		url: '/applet/agent/performance/change',
		method: "GET",
		params: params
	});
}
//业绩明细 类型筛选 
export function getAgentPerformanceType() {
	return request({
		url: '/applet/agent/performance/type',
		method: "GET"
	});
}

// 代理业绩明细
export function getPerformanceDetailList(params: any) {
	// let paramsQuery : any = JSON.parse(JSON.stringify(params))
	return request({
		url: '/applet/agent/performance/detail/list',
		method: "GET",
		params: params,
	});
}


